//
// Created by wze-zero on 2024/7/14 014.
//
#include <iostream>

using namespace std;

int main() {
    char str[30];
    cin.getline(str, sizeof(str));
    int m;
    cin >> m;
    char scp[30];
    char *ptr = str + m - 1;
    int n = 0;
    while (*ptr != '\0') {
        scp[n++] = *ptr;
        ptr++;
    }
    scp[n] = '\0';
    cout << scp << endl;
    return 0;
}
